import React from 'react';
import { Consumer } from '../../index';
import styles from './index.less';

const HeaderData = () => {
  return (
    <Consumer>
      {({ menuCode, key, updateData, dateBody }) => (
        <div className={styles.box}>
          <span>
            数据最近更新时间：
            <span>{(dateBody[menuCode] && dateBody[menuCode].replace(/-/g, '.')) || '-'}</span>
          </span>
          <span>
            数据管理员：<span>{updateData[key]?.user || '-'}</span>
          </span>
          <span>
            维护方式：<span>{updateData[key]?.method || '-'}</span>
          </span>
          <span>
            更新时间：<span>{updateData[key]?.updateDate || '-'}</span>
          </span>
        </div>
      )}
    </Consumer>
  );
};
export default HeaderData;
